package playGame;

import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.Collections;

/**
 * Date: 2023-04-24
 * Time: 16:25
 */
public class pokerGame {
        // 牌盒
        static ArrayList<String> list = new ArrayList<>();

        static {
            // 准备牌
            String[] color = {"♥","♠","♣","♦"};
            String[] number = {"3","4","5","6","7","8","9","10","J","Q","K","A","2"};
            for(String s:color){
                for(String n:number){
                    list.add(s+n);
                }
            }
            list.add("小王");
            list.add("大王");
        }


    public pokerGame(){
        // 洗牌
        Collections.shuffle(list);

        // 发牌
        ArrayList<String> poker1 = new ArrayList<>();
        ArrayList<String> poker2 = new ArrayList<>();
        ArrayList<String> poker3 = new ArrayList<>();
        ArrayList<String> poker = new ArrayList<>();


        for (int i = 0; i < list.size(); i++) {
            if(i<3){
                // 添加底牌
                poker.add(list.get(i));
                continue;
            }

            if(i%3==0){
                poker1.add(list.get(i));
            } else if (i%3==1) {
                poker2.add(list.get(i));
            }else{
                poker3.add(list.get(i));
            }
        }

        // 看牌
        lookPoker("底牌",poker);
        lookPoker("刚脑壳",poker1);
        lookPoker("大帅比",poker2);
        lookPoker("饭桶",poker3);
    }

    public void lookPoker(String name,ArrayList<String> list){
        System.out.print(name+" ");
        for (int i = 0; i < list.size(); i++) {
            String poker = list.get(i);
            System.out.print(poker+" ");
        }
        System.out.println();
    }
}
